]> permondes.de Git - Analog_Engine.git/blob - scripts/Superposition of oscillations.LACE
Further examples of harmonic oscillation
[Analog_Engine.git] / scripts / Superposition of oscillations.LACE
1 # Superposition of the oscillation of two undamped harmonic oscillators
2 # x1'' = -omega1^2*x1
3 # x2'' = -omega2^2*x2
4
5 coefficient.1(-1) -> -x10 # amplitude of 1
6 coefficient.2 -> omega1^2
7 coefficient.5(-1) -> -x20 # amplitude of 2
8 coefficient.6 -> omega2^2
9
10 # 1st oscillator
11 iintegrate x1'' -> -x1'
12 iintegrate -x1' -> x1
13 IC: -x10
14 cmultiply x1, omega1^2 -> omega1^2*x1
15 invert omega1^2*x1 -> -omega1^2*x1
16 assign -omega1^2*x1 -> x1''
17 output x1 -> out.x
18
19 # 2nd oscillator
20 iintegrate x2'' -> -x2'
21 iintegrate -x2' -> x2
22 IC: -x20
23 cmultiply x2, omega2^2 -> omega2^2*x2
24 invert omega2^2*x2 -> -omega2^2*x2
25 assign -omega2^2*x2 -> x2''
26 output x2 -> out.y
27
28 # Sum
29 isum x1, x2 -> -(x1+x2)
30 invert -(x1+x2) -> x1+x2
31 output x1+x2 -> out.z